#!/bin/bash
nodeFILE=/tmp/condor_nodes
scp -rpB root@condor.ihep.ac.cn:/root/condor/condor_machine_list $nodeFILE
nodeLIST=`awk '{print $1}' $nodeFILE`
echo $nodeLIST
cat /etc/puppet/environments/production/modules/condorworknode/tests/parmhead.pp > /tmp/condor-params.pp
for Line in $nodeLIST
do
  echo "  \"$Line\"," >> /tmp/condor-params.pp
done

echo "  ]" >> /tmp/condor-params.pp
echo "}"   >> /tmp/condor-params.pp

OUT=`puppet parser validate /tmp/condor-params.pp 2>& 1`
if [ "x${OUT}" == "x" ]
then
  /bin/cp /tmp/condor-params.pp /etc/puppet/environments/production/modules/condorworknode/manifests/params.pp
fi
